#============================================================
#    Timer Utils
#============================================================
# - datetime: 2022-09-30 00:27:04
#============================================================

class_name TimerUtils


static func create_timer(time:float=1.0, host: Node=null, callable:Callable=Callable()) -> Timer:
	var timer := Timer.new()
	if time > 0:
		timer.wait_time = time
	timer.one_shot = true
	timer.autostart = false
	if host == null:
		host = Engine.get_main_loop().current_scene
	if not callable.is_null():
		timer.timeout.connect(callable)
	host.add_child.call_deferred(timer)
	return timer



